<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>1</div>
    <div>4</div>
    <div>3</div>
    <div>6</div>
    <div>2</div>
    <div>5</div>
    <script>
        //扩展运算符可以将数组拆分成以逗号分隔的参数序列
        // let arr = ['a','b','c'];
        // //...arr // 'a','b','c'
        // console.log(...arr);
        // console.log('a','b','c');

        // //扩展运算符应用于数组合并
        // let arr1 = [1,2,3];
        // let arr2 = [4,5,6];
        // let arr3 = [...arr1,...arr2];
        // console.log(arr3);

        // //合并数组的第二种方法
        // let arr1 = [1,2,3];
        // let arr2 = [4,5,6];
        // //arr1.push(4,5,6);
        // arr1.push(...arr2)
        // console.log(arr1);

        //利用扩展运算符将伪数组转换为真正的数组
        //var oDivs = document.getElementsByTagName('div');
        //var oDivs = document.querySelector('div');
        //{div}
        //{"0":div,"1":div,"2":div,"3":div,"4":div,"5":div,"length":6}
        var oDivs = [1];
        console.log(typeof(oDivs));
        var arr = [...oDivs];
        arr.push('a');
        console.log(arr);
    </script>
</body>
</html>